package com.jx.lcs.usersession.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.jx.lcs.user.entity.UserInfo;

/**
 * 用户登录状态
 */
@Entity
@Table(name = "tb_user_session")
public class UserSession implements java.io.Serializable {

	private static final long serialVersionUID = 1L;

	private String id;				//主键ID
	
	private String uid;				//用户编号
	
	private String token;			//用户标识
	
	private String gid;				//设备号
	
	private String os;				//操作系统
	
	private String version;			//版本
	
	private String channelId;		//渠道号
	
	private String status;			//用户状态
	
	private Date lastLoginTime;		//最新的登录时间
	
	private String baidu_userId;	//百度推送用户ID
	
	private Long baidu_channelId;	//百度推送渠道ID
	
	private String appType;			//app版本，线下or线上
	
	private UserInfo userInfo;		//用户

	// Constructors


	@Id
	@Column(name = "ID", unique = true, nullable = false)
	public String getId() {
		return this.id;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "UID", referencedColumnName="UID")
	public UserInfo getUserInfo() {
		return userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}

	@Column(name = "UID",insertable = false,updatable = false)
	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	@Column(name = "TOKEN")
	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	@Column(name = "GID")
	public String getGid() {
		return gid;
	}

	public void setGid(String gid) {
		this.gid = gid;
	}

	@Column(name = "OS")
	public String getOs() {
		return os;
	}

	public void setOs(String os) {
		this.os = os;
	}

	@Column(name = "VERSION")
	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	@Column(name = "CHANNELID")
	public String getChannelId() {
		return channelId;
	}

	public void setChannelId(String channelId) {
		this.channelId = channelId;
	}

	@Column(name = "STATUS")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "LASTLOGINTIME")
	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	@Column(name = "BAIDU_USERID")
	public String getBaidu_userId() {
		return baidu_userId;
	}

	public void setBaidu_userId(String baidu_userId) {
		this.baidu_userId = baidu_userId;
	}

	@Column(name = "BAIDU_CHANNELID")
	public Long getBaidu_channelId() {
		return baidu_channelId;
	}

	public void setBaidu_channelId(Long baidu_channelId) {
		this.baidu_channelId = baidu_channelId;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "APPTYPE")
	public String getAppType() {
		return appType;
	}

	public void setAppType(String appType) {
		this.appType = appType;
	}

}